package com.paypal.android.MEP.a;

import android.content.Context;
import android.graphics.Typeface;
import android.text.Editable;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.method.PasswordTransformationMethod;
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.text.util.Linkify;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.paypal.android.MEP.PayPalActivity;
import com.paypal.android.MEP.b.a;
import com.paypal.android.MEP.b.d;
import com.paypal.android.MEP.l;
import com.paypal.android.a.c;
import com.paypal.android.a.g;
import com.paypal.android.a.q;
import com.paypal.android.b.k;
import com.paypal.android.b.m;
import com.paypal.android.b.n;
import java.util.regex.Pattern;

public final class o extends n
  implements View.OnClickListener, d, com.paypal.android.MEP.r, com.paypal.android.b.i
{
  private static com.paypal.android.b.f n = null;
  private p a;
  private com.paypal.android.MEP.b.e b;
  private Button c;
  private Button d;
  private Button e;
  private Button f;
  private k g;
  private k h;
  private String i;
  private LinearLayout j;
  private LinearLayout k;
  private RelativeLayout l;
  private TextView m = null;

  public o(Context paramContext)
  {
    super(paramContext);
  }

  private void a(p paramp)
  {
    this.a = paramp;
    h.b();
  }

  public final void a()
  {
  }

  public final void a(int paramInt, Object paramObject)
  {
    PayPalActivity.a().a((String)c.f().d("PreapprovalKey"), (String)c.f().d("PaymentExecStatus"), true);
  }

  public final void a(Context paramContext)
  {
    l locall = com.paypal.android.MEP.e.a().d();
    super.a(paramContext);
    label1638: LinearLayout localLinearLayout10;
    if (locall.d())
    {
      c.f().b("mpl-preapproval-PIN");
      this.a = p.a;
      LinearLayout localLinearLayout1 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout1.setOrientation(1);
      localLinearLayout1.setPadding(5, 5, 5, 15);
      localLinearLayout1.addView(q.b(com.paypal.android.a.r.a, paramContext));
      this.b = new com.paypal.android.MEP.b.e(paramContext, this);
      this.b.a(this);
      localLinearLayout1.addView(this.b);
      addView(localLinearLayout1);
      this.j = new LinearLayout(paramContext);
      this.j.setOrientation(1);
      this.j.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
      this.j.setPadding(5, 5, 5, 5);
      this.j.setBackgroundDrawable(com.paypal.android.a.f.a());
      com.paypal.android.b.j localj1 = new com.paypal.android.b.j(com.paypal.android.a.j.a("ANDROID_create_code"), paramContext);
      this.j.addView(localj1);
      TextView localTextView1 = new TextView(paramContext);
      localTextView1.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView1.setBackgroundColor(0);
      localTextView1.setTextColor(-13408615);
      localTextView1.setGravity(3);
      localTextView1.setTypeface(Typeface.create("Helvetica", 1));
      localTextView1.setTextSize(12.0F);
      localTextView1.setPadding(5, 5, 5, 5);
      localTextView1.setText(com.paypal.android.a.j.a("ANDROID_require_pin").replace("%m", locall.a()));
      this.j.addView(localTextView1);
      LinearLayout localLinearLayout2 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout2.setOrientation(1);
      localLinearLayout2.setPadding(5, 10, 5, 10);
      this.h = new k(paramContext, m.b);
      this.h.a("This page is currently being used to test components.");
      this.h.setPadding(0, 5, 0, 5);
      this.h.setVisibility(8);
      localLinearLayout2.addView(this.h);
      this.j.addView(localLinearLayout2);
      EditText localEditText1 = new EditText(paramContext);
      localEditText1.setInputType(3);
      localEditText1.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
      localEditText1.setHint(com.paypal.android.a.j.a("ANDROID_enter_code"));
      localEditText1.setSingleLine(true);
      localEditText1.setId(8001);
      localEditText1.setTransformationMethod(PasswordTransformationMethod.getInstance());
      this.j.addView(localEditText1);
      EditText localEditText2 = new EditText(paramContext);
      localEditText2.setInputType(3);
      localEditText2.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
      localEditText2.setHint(com.paypal.android.a.j.a("ANDROID_reenter_code"));
      localEditText2.setSingleLine(true);
      localEditText2.setId(8002);
      localEditText2.setTransformationMethod(PasswordTransformationMethod.getInstance());
      this.j.addView(localEditText2);
      LinearLayout localLinearLayout3 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout3.setOrientation(1);
      localLinearLayout3.setGravity(1);
      this.f = new Button(paramContext);
      this.f.setText(com.paypal.android.a.j.a("ANDROID_create"));
      this.f.setLayoutParams(new LinearLayout.LayoutParams(-1, com.paypal.android.a.f.b(), 0.5F));
      this.f.setGravity(17);
      this.f.setBackgroundDrawable(g.a());
      this.f.setTextColor(-16777216);
      this.f.setOnClickListener(this);
      LinearLayout localLinearLayout4 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout4.setOrientation(1);
      localLinearLayout4.setGravity(1);
      localLinearLayout4.addView(this.f);
      localLinearLayout4.setPadding(0, 15, 0, 15);
      localLinearLayout3.addView(localLinearLayout4);
      this.d = new Button(paramContext);
      this.d.setText(com.paypal.android.a.j.a("ANDROID_cancel"));
      this.d.setLayoutParams(new LinearLayout.LayoutParams(-1, com.paypal.android.a.f.b(), 0.5F));
      this.d.setGravity(17);
      this.d.setBackgroundDrawable(g.b());
      this.d.setTextColor(-16777216);
      this.d.setOnClickListener(this);
      localLinearLayout3.addView(this.d);
      this.j.addView(localLinearLayout3);
      addView(this.j);
      this.k = new LinearLayout(paramContext);
      this.k.setOrientation(1);
      this.k.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
      this.k.setPadding(5, 5, 5, 5);
      this.k.setBackgroundDrawable(com.paypal.android.a.f.a());
      com.paypal.android.b.j localj2 = new com.paypal.android.b.j(com.paypal.android.a.j.a("ANDROID_review"), paramContext);
      this.k.addView(localj2);
      LinearLayout localLinearLayout5 = new LinearLayout(paramContext);
      localLinearLayout5.setOrientation(1);
      localLinearLayout5.setBackgroundDrawable(com.paypal.android.a.f.a(-1, -1510918, -7829368));
      localLinearLayout5.setPadding(10, 10, 10, 10);
      this.k.addView(localLinearLayout5);
      TextView localTextView2 = new TextView(paramContext);
      localTextView2.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView2.setBackgroundColor(0);
      localTextView2.setTextColor(-7829368);
      localTextView2.setGravity(3);
      localTextView2.setTypeface(Typeface.create("Helvetica", 1));
      localTextView2.setTextSize(12.0F);
      localTextView2.setText(com.paypal.android.a.j.a("ANDROID_payment_method"));
      localLinearLayout5.addView(localTextView2);
      LinearLayout localLinearLayout6 = new LinearLayout(paramContext);
      localLinearLayout6.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localLinearLayout6.setOrientation(0);
      localLinearLayout5.addView(localLinearLayout6);
      TextView localTextView3 = new TextView(paramContext);
      localTextView3.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
      localTextView3.setBackgroundColor(0);
      localTextView3.setTextColor(-16777216);
      localTextView3.setGravity(3);
      localTextView3.setTypeface(Typeface.create("Helvetica", 0));
      localTextView3.setTextSize(12.0F);
      localTextView3.setText(com.paypal.android.a.j.a("ANDROID_primary_source") + ":");
      localLinearLayout6.addView(localTextView3);
      TextView localTextView4 = new TextView(paramContext);
      localTextView4.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView4.setBackgroundColor(0);
      localTextView4.setTextColor(-16777216);
      localTextView4.setGravity(5);
      localTextView4.setTypeface(Typeface.create("Helvetica", 0));
      localTextView4.setTextSize(12.0F);
      localTextView4.setText(com.paypal.android.a.j.a("ANDROID_paypal_balance"));
      localLinearLayout6.addView(localTextView4);
      TextView localTextView5 = new TextView(paramContext);
      localTextView5.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
      localTextView5.setBackgroundColor(0);
      localTextView5.setTextColor(-16777216);
      localTextView5.setGravity(3);
      localTextView5.setTypeface(Typeface.create("Helvetica", 0));
      localTextView5.setTextSize(12.0F);
      localTextView5.setPadding(10, 10, 10, 10);
      String str1 = com.paypal.android.a.j.a("ANDROID_preapproval_agreement").replace("%m", locall.a());
      String str2 = str1 + " " + com.paypal.android.a.j.a("ANDROID_view_policies");
      SpannableString localSpannableString = new SpannableString(str2);
      localSpannableString.setSpan(new UnderlineSpan(), str2.indexOf(com.paypal.android.a.j.a("ANDROID_view_policies")), localSpannableString.length(), 0);
      localSpannableString.setSpan(new URLSpan(new String("https://www.paypal.com/" + PayPalActivity.b.h().substring(0, 2) + "/cgi-bin/webscr?cmd=xpt/Marketing/popup/FundingMixEducation-outside")), str2.indexOf(com.paypal.android.a.j.a("ANDROID_view_policies")), localSpannableString.length(), 33);
      Linkify.addLinks(localSpannableString, Pattern.compile(com.paypal.android.a.j.a("ANDROID_view_policies")), "https://");
      localTextView5.setText(localSpannableString);
      localTextView5.setMovementMethod(LinkMovementMethod.getInstance());
      this.k.addView(localTextView5);
      LinearLayout localLinearLayout7 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout7.setOrientation(1);
      localLinearLayout7.setPadding(5, 10, 5, 10);
      this.g = new k(paramContext, m.b);
      this.g.a("This page is currently being used to test components.");
      this.g.setPadding(0, 5, 0, 5);
      this.g.setVisibility(8);
      localLinearLayout7.addView(this.g);
      this.k.addView(localLinearLayout7);
      LinearLayout localLinearLayout8 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout8.setOrientation(1);
      localLinearLayout8.setGravity(1);
      this.c = new Button(paramContext);
      if (com.paypal.android.MEP.e.a().d().f() != 1)
        break label2068;
      this.c.setText(com.paypal.android.a.j.a("ANDROID_agree_pay"));
      this.c.setLayoutParams(new LinearLayout.LayoutParams(-1, com.paypal.android.a.f.b(), 0.5F));
      this.c.setGravity(17);
      this.c.setBackgroundDrawable(g.a());
      this.c.setTextColor(-16777216);
      this.c.setOnClickListener(this);
      LinearLayout localLinearLayout9 = com.paypal.android.a.f.a(paramContext, -1, -2);
      localLinearLayout9.setOrientation(1);
      localLinearLayout9.setGravity(1);
      localLinearLayout9.addView(this.c);
      localLinearLayout9.setPadding(0, 15, 0, 15);
      localLinearLayout8.addView(localLinearLayout9);
      this.e = new Button(paramContext);
      this.e.setText(com.paypal.android.a.j.a("ANDROID_cancel"));
      this.e.setLayoutParams(new LinearLayout.LayoutParams(-1, com.paypal.android.a.f.b(), 0.5F));
      this.e.setGravity(17);
      this.e.setBackgroundDrawable(g.b());
      this.e.setTextColor(-16777216);
      this.e.setOnClickListener(this);
      localLinearLayout8.addView(this.e);
      this.k.addView(localLinearLayout8);
      addView(this.k);
      this.l = new RelativeLayout(paramContext);
      this.l.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
      this.l.setBackgroundDrawable(com.paypal.android.a.f.a());
      localLinearLayout10 = com.paypal.android.a.f.a(paramContext, -1, -2);
      RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(localLinearLayout10.getLayoutParams());
      localLayoutParams.addRule(13);
      localLinearLayout10.setLayoutParams(localLayoutParams);
      localLinearLayout10.setOrientation(1);
      localLinearLayout10.setGravity(1);
      if (n != null)
        break label2084;
      n = new com.paypal.android.b.f(paramContext);
    }
    while (true)
    {
      this.m = q.a(com.paypal.android.a.r.b, paramContext);
      this.m.setGravity(1);
      this.m.setTextColor(-13408615);
      this.m.setText(com.paypal.android.a.j.a("ANDROID_processing_transaction_message"));
      localLinearLayout10.addView(n);
      localLinearLayout10.addView(this.m);
      this.l.addView(localLinearLayout10);
      this.l.setVisibility(8);
      addView(this.l);
      if (!locall.d())
        break label2099;
      this.k.setVisibility(8);
      return;
      this.a = p.b;
      break;
      label2068: this.c.setText(com.paypal.android.a.j.a("ANDROID_agree"));
      break label1638;
      label2084: ((LinearLayout)n.getParent()).removeAllViews();
    }
    label2099: this.j.setVisibility(8);
  }

  public final void a(a parama, int paramInt)
  {
  }

  public final void a(com.paypal.android.b.h paramh, int paramInt)
  {
    if ((paramInt == 1) && (this.b != null) && (paramh != this.b))
      this.b.a(0);
  }

  public final void a(String paramString)
  {
    if (this.a == p.c)
    {
      this.i = paramString;
      a(p.d);
    }
  }

  public final void a(String paramString, Object paramObject)
  {
  }

  public final p b()
  {
    return this.a;
  }

  public final void d()
  {
    if (this.a == p.c)
    {
      this.b.a(false, true);
      this.j.setVisibility(8);
      this.k.setVisibility(8);
      this.l.setVisibility(0);
      n.a();
    }
    while ((this.a != p.a) && (this.a != p.b) && (this.a != p.d))
      return;
    this.b.a(true, false);
    n.b();
    this.l.setVisibility(8);
    if (this.a == p.a)
    {
      this.j.setVisibility(0);
      this.k.setVisibility(8);
      return;
    }
    if (this.a == p.b)
    {
      this.j.setVisibility(8);
      this.k.setVisibility(0);
      return;
    }
    if (this.k.getVisibility() == 0)
    {
      this.g.a(this.i);
      this.g.setVisibility(0);
      return;
    }
    this.h.a(this.i);
    this.h.setVisibility(0);
  }

  public final void e()
  {
  }

  public final void onClick(View paramView)
  {
    int i1 = 0;
    if ((this.d == paramView) || (this.e == paramView))
      new com.paypal.android.MEP.b.i(PayPalActivity.a()).show();
    do
    {
      return;
      if (this.c == paramView)
      {
        a(p.c);
        if (com.paypal.android.MEP.e.a().k() == 2)
        {
          PayPalActivity.a().a("Demo Preapproval Key", "COMPLETED", true);
          return;
        }
        c.f().a("delegate", this);
        c.f().a(14);
        return;
      }
    }
    while (this.f != paramView);
    try
    {
      ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(findViewById(8001).getWindowToken(), 0);
      try
      {
        ((InputMethodManager)PayPalActivity.a().getSystemService("input_method")).hideSoftInputFromWindow(findViewById(8002).getWindowToken(), 0);
        label152: Editable localEditable1 = ((EditText)findViewById(8001)).getText();
        Editable localEditable2 = ((EditText)findViewById(8002)).getText();
        String str1 = localEditable1.toString();
        String str2 = localEditable2.toString();
        if ((str1 == null) || (str2 == null))
        {
          i2 = 1;
          if (!str1.equals(str2))
            i2 = 1;
          if (str1.length() >= 4)
          {
            int i3 = str1.length();
            i1 = 0;
            if (i3 <= 8);
          }
          else
          {
            i2 = 1;
          }
          while (i1 < str1.length())
          {
            if ((str1.charAt(i1) < '0') || (str1.charAt(i1) > '9'))
              i2 = 1;
            i1++;
          }
          if (i2 != 0)
          {
            this.i = com.paypal.android.a.j.a("ANDROID_pin_invalid");
            a(p.d);
            return;
          }
          c.f().a("Pin", str1);
          a(p.b);
          return;
        }
      }
      catch (Exception localException2)
      {
        break label152;
      }
    }
    catch (Exception localException1)
    {
      while (true)
      {
        continue;
        int i2 = 0;
      }
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.paypal.android.MEP.a.o
 * JD-Core Version:    0.6.2
 */